<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%String path = request.getContextPath();%>
<script type="text/javascript">
var allPicArray = new Array();
function confirmAddPicContent(args){
	var fileName = args["fileName"];
	var fileSize = args["fileSize"];
	var arg1 = "pic_div_content_";
	var str = '<div id="'+arg1+'" style="border:1 solid #ccc;margin-top:5px;margin-bottom:5px;padding:5px;width:400px">';
	str += '<b style="margin-left:15px">图片大小：</b>'+fileSize+'KB<b style="margin-left:15px">图片：</b>';
	str += '<a href="${pageContext.request.contextPath}/jsp/common/preview_image.jsp?folder=webIndexPic&picNames='+fileName+'" target="dialog" max="true" title="预览图片" width="800" height="480" style="margin-right: 40px">'+fileName+'</a>';
	str += '</div>';
	$("#"+arg1).replaceWith($(str));
	$("input[name='webFileVO.fileName']").val(fileName);
	$("input[name='webFileVO.fileSize']").val(fileSize);
	$("input[name='oldPic']").val(old_pic);
	allPicArray.push(fileName);
}
function setWebFileVOValue(obj) {
	if ($("input[name='webFileVO.fileName']").val()==""){
		alert("请添加图片！");
		$('#add_pic_a_id').trigger('click');
		return false;
	}
	allPicArray.splice($.inArray($("input[name='webFileVO.fileName']").val(),allPicArray),1);
	$("input[name='removePics']").val(allPicArray.join(","));
	return validateCallback(obj, navTabAjaxDone);
}
</script>
	<div class="pageContent">
		<form method="post" action="<%=path%>/webManager/savePic.action" class="pageForm required-validate" onsubmit="return setWebFileVOValue(this);">
			<input type="hidden" name="webFileVO.fileName" value="${webFileVO.fileName}"/>
			<input type="hidden" name="webFileVO.type" value="${webFileVO.type}"/>
			<input type="hidden" name="webFileVO.fileSize" value="${webFileVO.fileSize}"/>
			<input type="hidden" name="webFileVO.id" value="${webFileVO.id}"/>
			<input type="hidden" name="removePics"/>
			<input type="hidden" name="oldPic"/>
			<div class="pageFormContent" layoutH="56" style="width: 98%">
				<p style="width: 50%">
					<label>图片名称：</label>
					<input type="text" name="webFileVO.name" value="${webFileVO.name}" class="required" alt="请输入图片名称" size="30"/>
				</p>
				<p style="width: 50%">
					<label>是否置顶：</label>
					<input type="radio" name="webFileVO.top" value="1"/>是
					<input type="radio" name="webFileVO.top" value="0" checked="checked"/>否
				</p>
				<div class="divider" style="border:0;height:70px"></div>
				<p style="width: 100%">
					<label>首页图片：</label>
					<a class="button" onclick="$('#add_pic_a_id').trigger('click');"><span>添加图片</span></a>
					<a id="add_pic_a_id" class="btnAttach" href="<%=path%>/jsp/webManager/pic/pic_upload.jsp" lookupGroup="" width="560" height="300" style="display: none"></a>
					<div class="divider" style="border:0"></div>
					<div id="pic_content_div" style="float: none;width:auto;padding-left: 150px;">
						<div id="pic_div_content_" style="border:1 solid #ccc;margin-top:5px;margin-bottom:5px;padding:5px;width:400px">
						<b style="margin-left:15px">图片大小：</b>${webFileVO.fileSize}KB
						<b style="margin-left:15px">图片：</b><a href="${pageContext.request.contextPath}/jsp/common/preview_image.jsp?folder=webIndexPic&picNames=${webFileVO.fileName}" target="dialog" max="true" title="预览图片" width="800" height="480" style="margin-right: 40px">${webFileVO.fileName}</a>
						</div>
					</div>
					<div id="pic_div_content_"></div>
				</p>
			</div>
			<div class="formBar">
				<ul>
					<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
					<li>
						<div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
					</li>
				</ul>
			</div>
		</form>
	</div>